from app.database import Database
from app.model import Model

def main():
    model = Model()
    databdase = Database(model=model, create=True)
    question = "令狐冲领悟了什么魔法？"
    chunks = databdase.query(question)
    prompt = "Please answer user's question according to context\n"
    prompt += f"Question: {question}\n"
    prompt += "Context:\n"
    for chunk in chunks:
        prompt += f'{chunk}\n'
        prompt += '-------------\n'

    result = model.chat(prompt)
    print('\n\n', result)


if __name__ == '__main__':
    main()
    